﻿using System.IO.IsolatedStorage;

namespace PhotoMap
{
    /// <summary>
    /// 用户配置文件
    /// </summary>
    public static class UserConfig
    {
        /// <summary>
        /// 是否第一次加载
        /// </summary>
        public static bool IsFirstLoad
        {
            get
            {
                bool isFirstLoad;
                return !IsolatedStorageSettings.ApplicationSettings.TryGetValue(
                    "IsFirstLoad", out isFirstLoad) || isFirstLoad;
            }
            set
            {
                if (IsolatedStorageSettings.ApplicationSettings.Contains("IsFirstLoad"))
                {
                    IsolatedStorageSettings.ApplicationSettings["IsFirstLoad"] = value;
                }
                else
                {
                    IsolatedStorageSettings.ApplicationSettings.Add("IsFirstLoad", value);
                }
            }
        }

        /// <summary>
        /// 是否允许定位服务
        /// </summary>
        public static bool IsAllowLocate
        {
            get
            {
                bool isAllowLocate;
                return IsolatedStorageSettings.ApplicationSettings.TryGetValue(
                    "IsAllowLocate", out isAllowLocate) && isAllowLocate;
            }
            set
            {
                if (IsolatedStorageSettings.ApplicationSettings.Contains("IsAllowLocate"))
                {
                    IsolatedStorageSettings.ApplicationSettings["IsAllowLocate"] = value;
                }
                else
                {
                    IsolatedStorageSettings.ApplicationSettings.Add("IsAllowLocate", value);
                }
            }
        }

    }
}
